package models

import (
	"time"

	"github.com/kataras/iris/v12"
)

const (
	OK        = 200
	Good      = 200
	Success   = 200
	Bad       = 400
	Failure   = 400
	Not_Found = 404
)

func Rise(entry string, data interface{}) iris.Map {
	return iris.Map{
		"code":   OK,
		"entry":  entry,
		"result": data}
}

func Fail(entry string) iris.Map {
	return iris.Map{
		"code":  Failure,
		"entry": entry}
}

func GenTopics(entry string, items interface{}) iris.Map {
	return iris.Map{
		"code":   OK,
		"entry":  entry,
		"topics": items}
}

func GenDetails(entry string, items interface{}) iris.Map {
	return iris.Map{
		"code":    OK,
		"entry":   entry,
		"details": items}
}

func GenIndex(entry string) iris.Map {
	return iris.Map{
		"code":  OK,
		"entry": entry,
		"time":  time.Now().Format("2006-01-02 15:04:05")}
}
